package com.msw.jcwapi.wb.wbdwq.controller;


import com.msw.jcwapi.common.result.Result;
import com.msw.jcwapi.wb.wbdwq.entity.Wbdwq;
import com.msw.jcwapi.wb.wbdwq.service.IWbdwqService;
import com.msw.jcwapi.wb.wbjyz.entity.Wbjyz;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;

/**
 * <p>
 *  前端控制器
 * </p>
 *
 * @author author
 * @since 2025-04-01
 */
@RestController
@RequestMapping("/wbdwq")
public class WbdwqController {

    @Autowired
    private IWbdwqService wbdwqService;

    //    查询id对应工程的全部定位器类型
    @GetMapping("/list/{id}")
    public Result list(@PathVariable Integer id) {
        return Result.ok(wbdwqService.listByProId(id));
    }

    //通过wbdwqid删除该定位器的信息
    @DeleteMapping("/delete/{id}")
    public Result delete(@PathVariable Integer id) {
        return Result.ok(wbdwqService.deleteById(id));
    }

    //通过did查询该定位器的全部信息
    @GetMapping("/listByWbdwqId/{id}")
    public Result listByWbdwqId(@PathVariable Integer id) {
        return Result.ok(wbdwqService.listByWbdwqId(id));
    }

    //编辑腕臂定位器(通过id编辑)
    @PutMapping
    public Result update(@RequestBody Wbdwq wbdwq){
        return  Result.ok(wbdwqService.update(wbdwq));
    }

    //添加腕臂定位器
    @PostMapping
    public Result save(@RequestBody Wbdwq wbdwq){
        return Result.ok(wbdwqService.add(wbdwq));
    }

}
